package com.guigu.dh.common.exception;

import com.guigu.dh.common.result.ResultCodeEnum;
import io.swagger.annotations.ApiModelProperty;

public class YyghException extends RuntimeException{

    @ApiModelProperty(value = "异常状态码")
    private Integer code;

    public YyghException(String message , Integer code){
        super(message);
        this.code = code;
    }

    public YyghException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return "YyghException{" +
                "code=" + code +
                "message=" + this.getMessage() +
                '}';
    }
}
